// 引入 request 文件
import request from '@/api/request'

// ==================== 首页轮播图 ====================
// 获取轮播图列表
export const getBannerList = (data) => {
	return request({
		url: 'banner/list',
		method: 'get',
		data: data,
		query: true
	})
}

// 获取轮播图详情
export const getBannerDetail = (data) => {
	return request({
		url: 'banner/get',
		method: 'get',
		data: data,
		query: true
	})
}

// ==================== 系统公告 ====================
// 获取公告列表
export const getNoticeList = (data) => {
	return request({
		url: 'notice/page',
		method: 'get',
		data: data,
		query: true
	})
}

// 获取公告详情
export const getNoticeDetail = (data) => {
	return request({
		url: 'notice/get',
		method: 'get',
		data: data,
		query: true
	})
}

// ==================== 分类管理 ====================
// 获取分类列表
export const getCategoryList = (data) => {
	return request({
		url: 'category/list',
		method: 'get',
		data: data,
		query: true
	})
}

// 获取推荐分类
export const getRecommendCategory = (data) => {
	return request({
		url: 'category/recommend',
		method: 'get',
		data: data,
		query: true
	})
}

// ==================== 搜索功能 ====================
// 搜索记录
export const getSearchRecord = (data) => {
	return request({
		url: 'search/records',
		method: 'get',
		data: data,
		query: true
	})
}

// 搜索
export const search = (data) => {
	return request({
		url: 'product/search',
		method: 'get',
		data: data,
		query: true
	})
}

// 删除搜索记录
export const deleteSearchRecord = (data) => {
	return request({
		url: 'search/delete',
		method: 'post',
		data: data,
		query: true
	})
}

// 获取热门搜索
export const getHotSearch = (data) => {
	return request({
		url: 'search/hot',
		method: 'get',
		data: data,
		query: true
	})
}

// ==================== 用户签到 ====================
// 签到
export const signIn = (data) => {
	return request({
		url: 'user/signIn',
		method: 'post',
		data: data,
		query: true
	})
}

// 获取签到记录
export const getSignInRecord = (data) => {
	return request({
		url: 'user/signInRecord',
		method: 'get',
		data: data,
		query: true
	})
}

// ==================== 系统配置 ====================
// 获取系统配置
export const getSystemConfig = (data) => {
	return request({
		url: 'systemConfig/queryByKey',
		method: 'get',
		data: data,
		query: true
	})
}

// 更新用户位置
export const updatePosition = (data) => {
	return request({
		url: 'mine/updatePosition',
		method: 'post',
		data: data
	})
}
